#构建镜像初始的依赖镜像（镜像名:版本号，缺省版本号时为latest）
FROM yy-jdk17

#指定镜像创建者信息
Maintainer YY

#设置语言
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8

#设置时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

#在容器中创建目录
RUN mkdir /game
RUN mkdir /game/t2
RUN mkdir /game/t2/common-libs
RUN mkdir /game/t2/jar
RUN mkdir /game/t2/config
RUN mkdir /game/t2/ajson
RUN mkdir /game/t2/logs
RUN mkdir /game/t2/uploadfiles

#COPY 当前目录下的文件 目标文件夹
COPY ./common-libs/* /game/t2/common-libs
COPY ./jar/* /game/t2/jar

#设置进行容器时的工作目录，也是程序启动的目录，如果不进行此设置，会影响到springboot无法正常加载config配置
WORKDIR /game/t2

ENTRYPOINT ["java", "-server", "-javaagent:./jar/gaming-agent-0.0.1.jar", "-XX:+HeapDumpOnOutOfMemoryError", "-Xms1024M", "-Xmx2048M", "-classpath", "./config/*:./common-libs/*:./jar/*:", "org.t2.game.server.T2GameServer", ">", "./log_console.log", "&"]

#使用如下命令进行构建
#docker build -t t2-game-server:202412231000 .
